﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SysUserList.aspx.cs" Inherits="ExaminationSys.View.Users.SysUserList" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register src="SysUserEdit.ascx" tagname="SysUserEdit" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
     <script type="text/javascript" language="javascript">
         var newsTypeEditDetailsRender = function () {
             return '<img class="ImageEdit" ext:qtip="编辑" style="cursor:pointer;" src="../../images/vcard_edit.png" />';
         };
         var template = '<span style="color:{0};">{1}</span>';
         var StatusRaw = function (value) {
             switch (value) {
                 case 1:
                     return Ext.String.format(template, "green", "是");
                 case 0:
                     return Ext.String.format(template, "red", "否");
             }
         };

         var isLock = function (value) {
             switch (value) {
                 case 1:
                     return Ext.String.format(template, "green", "是");
                 case 0:
                     return Ext.String.format(template, "red", "否");
             }
         };

     </script>
</head>

<body>
    <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server"/>
         <ext:Store ID="StoreEntity"
            runat="server"
            ShowWarningOnFailure="true"
            AutoLoad="true"
            PageSize="5"
            OnReadData="StoreEntity_RefreshData">
            <Proxy>
                <ext:PageProxy>                    
                    <Listeners>
                        <Exception Handler="Ext.MessageBox.alert('Load failed', response.statusText);" />
                    </Listeners>
                </ext:PageProxy>
            </Proxy>
            <Model>
                <ext:Model ID="Model" runat="server" IDProperty="ID">
                    <Fields>
                        <ext:ModelField Name="ID"/>
                        <ext:ModelField Name="UserNo" />
                        <ext:ModelField Name="UserName" />
                        <ext:ModelField Name="LoginName" />
                        <ext:ModelField Name="Sex" />
                        <ext:ModelField Name="CollegeName" />
                        <ext:ModelField Name="MajorName" />
                        <ext:ModelField Name="ClassName" />
                        <ext:ModelField Name="LockKey" Type="Int" />
         <%--               <ext:ModelField Name="IsRecommend" Type="Boolean" />
                        <ext:ModelField Name="Opeator" />
                        <ext:ModelField Name="OpeatorTime" Type="Date" />--%>
                    </Fields>
                </ext:Model>
            </Model>
            <AutoLoadParams>
                <ext:Parameter Name="start" Value="0" Mode="Raw" />
                <ext:Parameter Name="limit" Value="10" Mode="Raw" />
            </AutoLoadParams>            
            <Sorters>
                <ext:DataSorter Property="OpeatorTime" Direction="DESC" />
            </Sorters>
            <Listeners>
                <Exception Handler="Ext.MessageBox.alert('Load failed', response.statusText);"></Exception>
            </Listeners>
        </ext:Store>
                 <ext:ViewPort ID="ViewPort1"  runat="server" Layout="fit">
        <Items>
        <ext:GridPanel 
            ID="GridPanelEntity" 
            runat="server" 
            StoreID="StoreEntity"             
            Header="false"
            Border="false"
            TrackMouseOver="true"
            AutoExpandColumn="Title"
            >
          <%--  <Loader>
                <LoadMask ShowMask="true" Msg="加载中..."></LoadMask>
            </Loader>--%>
            <TopBar>
                <ext:Toolbar ID="Toolbar1" runat="server">
                    <Items>
                        <ext:Button ID="BtnAdd" runat="server" Text="新增" Icon="UserAdd">
                        <DirectEvents>
                            <Click OnEvent="Add_Click"></Click>
                        </DirectEvents>
                        </ext:Button>
                        <ext:Button runat="server" ID="BtnRefresh" Text="刷新" Icon="ArrowRefresh" >                           
                               <Listeners>
                                    <Click Handler="#{StoreEntity}.reload();"  />
                                </Listeners>                          
                        </ext:Button>
                    </Items>
                </ext:Toolbar>
            </TopBar>
            <SelectionModel> 
             <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1"  runat="server" Mode="Multi" />
            </SelectionModel>
            <ColumnModel ID="ColumnModel1" runat="server">
			    <Columns>
                    <ext:Column ID="Column1" runat="server" Header="ID" DataIndex="ID" Width="150" Hidden="true" />
                    <ext:Column ID="Column2"  runat="server" Header="学号" DataIndex="UserNo" Width="100" />
                    <ext:Column ID="Column4"  runat="server" Header="学生姓名" DataIndex="UserName"   Width="100" />
                    <ext:Column ID="Column5"  runat="server" Header="登录名" DataIndex="LoginName"  Width="100" />
                    <ext:Column ID="Column6"  runat="server" Header="性别" DataIndex="Sex"   Width="100" />
                    <ext:Column ID="Column7"  runat="server" Header="学院" DataIndex="CollegeName" Width="100" />
                    <ext:Column ID="Column8"  runat="server" Header="专业" DataIndex="MajorName"   Width="100" />
                    <ext:Column ID="Column9"  runat="server" Header="班级" DataIndex="ClassName"  Width="100" />
                    <ext:Column ID="Column10"  runat="server" Header="锁定" DataIndex="LockKey"   Width="100"/>
                    
                    <ext:CommandColumn ID="CommandColumn1"  runat="server" Width="120">
                        <Commands >
                            <ext:GridCommand Icon="NoteEdit" CommandName="Edit" Text="编辑" />   
                            <ext:GridCommand Icon="Delete"  CommandName="Delete" Text="删除" />                         
                        </Commands>             
                        <DirectEvents>
                            <Command OnEvent="Command">
                                <ExtraParams>
                                     <ext:Parameter Name="Id" Value="record.getId()" Mode="Raw" />
                                     <ext:Parameter Name="command" Value="command" Mode="Raw" />
                                </ExtraParams>
                               <Confirmation BeforeConfirm="if (command=='Edit') return false;" ConfirmRequest="true" Message="是否删除该记录?" Title="提示" />
                            </Command>
                        </DirectEvents>
                    </ext:CommandColumn>
			    </Columns>
                
            </ColumnModel>
            <Listeners>
            </Listeners> 
            <View>
                <ext:GridView ID="GridView1"  runat="server" />
            </View>    
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbar1" 
                    runat="server"                      
                    DisplayInfo="true" 
                    DisplayMsg="当前显示记录: {0} - {1}  共计: {2}" 
                    EmptyMsg="没有记录可以显示" 
                    
                    />
            </BottomBar>
        </ext:GridPanel>
        </Items>
        </ext:ViewPort>  
        <uc1:SysUserEdit ID="EditWindow" runat="server" />
    </form>
</body>
</html>
